<?php 
	//error reporting
	ini_set('error_reporting', E_ALL);
	ini_set('display_errors', 1);
	
	//-----------------------------------------------------------------------------------
	include_once("../classes/Database.class.php");
	$db = new Database();
	//-----------------------------------------------------------------------------------
	
	//----------------------------------------
	//GENERO DATOS
	$sql = "select 
				c.nombre as categoria, 
				g.monto,
				date_format(g.fecha, '%d-%m-%Y') as fecha,
				g.detalle,
				p.nombre as proveedor				
			from gastos g
			inner join categorias c on c.id = g.categoria
			inner join proveedores p on p.id = g.proveedor
			order by g.fecha desc
			";
	$data_array = $db->runQuery($sql);
	
	$data_html = "";	
	foreach($data_array as $record){
		extract($record);		
		if(!empty($categoria_options)) $categoria_options.="\n\t\t\t\t\t";
		$data_html .= "<tr>
						<td class='title'>$categoria</td>
						<td>$$monto</td>
						<td>$fecha</td>
						<td>$detalle</td>
						<td>$proveedor</td>
					   </tr>";
	}
	//----------------------------------------	
		
?>

				<table id="reportTable">
					<tr>
						<td class="rowTitle">Categor&iacute;a</td>
						<td class="rowTitle">Monto</td>
						<td class="rowTitle">Fecha</td>
						<td class="rowTitle">Detalle</td>
						<td class="rowTitle">Poveedor</td>
					</tr>
					<?php echo $data_html; ?>
				</table>
			